      SUBROUTINE E02AHZ(NP1,XMIN,XMAX,A,IA1,LA,PATM1,ADIF,IADIF1,LADIF)
C     MARK 8 RELEASE. NAG COPYRIGHT 1979.
C     MARK 11.5(F77) REVISED. (SEPT 1985.)
C
C     * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C
C     NPL DATA FITTING LIBRARY ROUTINE AUXCDF
C
C     CREATED 1/5/79    UPDATED 23/1/80     RELEASE NO. 00/03
C
C     AUTHORS.. GERALD T ANTHONY, MAURICE G COX, J GEOFFREY HAYES.
C     NATIONAL PHYSICAL LABORATORY
C     TEDDINGTON, MIDDLESEX, ENGLAND.
C
C     * * * * * * * * * * * * * * * * * * * * * * * * * * * *
C
C     INPUT PARAMETERS
C        NP1    = N+1 WHERE N IS DEGREE OF GIVEN POLYNOMIAL
C        XMIN   LOWER LIMIT OF RANGE OF X
C        XMAX   UPPER LIMIT OF RANGE OF X
C        A      COEFFICIENTS A0, A1,...AN OF THE GIVEN POLYNOMIAL
C        IA1       ARE STORED IN ARRAY A IN POSITIONS 1, 1+IA1,...
C                  1+N*IA1, RESPECTIVELY
C        LA     THE DECLARED DIMENSION OF ARRAY A
C
C     OUTPUT PARAMETERS
C        PATM1  THE VALUE OF THE GIVEN POLYNOMIAL AT XMIN
C        ADIF   THE COEFFICIENTS OF THE DERIVATIVE POLYNOMIAL
C        IADIF1    ARE RETURNED IN ARRAY ADIF IN POSITIONS
C                  1, 1+IADIF1,...1+(N-1)*IADIF1
C        LADIF  THE DECLARED DIMENSION OF ARRAY ADIF
C
C     DIFFERENTIATE THE SERIES WITH COEFFICIENTS A OF DEGREE N
C     (I.E. NP1 COEFFICIENTS) TO OBTAIN THE SERIES WITH COEFFICIENTS
C     ADIF OF DEGREE N-1. ALSO SET NEXT HIGHER COEFFICIENT TO ZERO.
C
C     .. Scalar Arguments ..
      DOUBLE PRECISION  PATM1, XMAX, XMIN
      INTEGER           IA1, IADIF1, LA, LADIF, NP1
C     .. Array Arguments ..
      DOUBLE PRECISION  A(LA), ADIF(LADIF)
C     .. Local Scalars ..
      DOUBLE PRECISION  PTEMP, R, SCLFTR, TWO, U, V, W
      INTEGER           I, N, NA, NADIF
C     .. Data statements ..
      DATA              TWO/2.0D+0/
C     .. Executable Statements ..
      U = 0.0D+0
      V = U
      SCLFTR = TWO/(XMAX-XMIN)
      N = NP1 - 1
      NADIF = N*IADIF1 + 1
      PTEMP = U
      IF (N.EQ.0) GO TO 40
      NA = N*IA1 + 1
      DO 20 I = 1, N
         R = NP1 - I
         W = U + TWO*R*A(NA)
         PTEMP = A(NA) - PTEMP
C
C        STORE COEFF FORMED PREVIOUS TIME ROUND. FIRST TIME ROUND
C        STORE ZERO AS COEFF OF DEGREE N.
C
         ADIF(NADIF) = SCLFTR*V
         U = V
         V = W
         NA = NA - IA1
         NADIF = NADIF - IADIF1
   20 CONTINUE
   40 ADIF(NADIF) = SCLFTR*V
      PATM1 = A(1)/TWO - PTEMP
      RETURN
C     END OF E02AHZ
      END
